import request from '@/axios';
import {baseUrl} from '@/config/env';

/**
 * 待办列表
 * @param data
 * @returns {AxiosPromise}
 */
function pageMyWaitAuthTask(data) {
    return request({
            url: baseUrl + '/startMyActTaskApi/pageMyWaitAuthTask',
            method: 'get',
            params: data
        }
    )
}

/**
 * 我审批过的
 * @param procDefKey
 * @param data
 * @returns {AxiosPromise}
 */
function pageMyDoneTask(data) {
    return request({
            url: baseUrl + '/startMyActTaskApi/pageMyDoneTask',
            method: 'get',
            params: data
        }
    )
}

function pageMyApply(data) {
    return request({
            url: baseUrl + '/startMyActTaskApi/pageMyDoneTask',
            method: 'get',
            params: data
        }
    )
}

/**
 * 获取任务审批信息
 * @param taskId
 * @returns {Promise<AxiosResponse<any>> | *}
 */
function getWaitAuthTaskDetail(taskId) {
    return request({
            url: baseUrl + '/startMyActTaskApi/getWaitAuthTaskDetail/' + taskId,
            method: 'get',

        }
    )
}

/**
 * 获取任务审批历史
 * @param taskId
 * @returns {Promise<AxiosResponse<any>> | *}
 */
function getHistoryTaskDetail(taskId) {
    return request({
            url: baseUrl + '/startMyActTaskApi/getHistoryTaskDetail/' + taskId,
            method: 'get',

        }
    )
}

/**
 * 处理任务节点
 * @param taskId
 * @returns {AxiosPromise}
 */
function handlerNodeApply(taskId, data) {
    return request({
            url: baseUrl + '/startMyActTaskApi/handlerNodeApply/' + taskId,
            method: 'post',
            data: data
        }
    )
}

const startMyActTaskApi = {
    pageMyWaitAuthTask,
    getWaitAuthTaskDetail,
    getHistoryTaskDetail,
    handlerNodeApply,
    pageMyDoneTask,
    pageMyApply,
}
export default startMyActTaskApi